﻿using JetBrains.Annotations;
using Missbot.AIModule.Base;
using Missbot.Common;
using Missbot.Core.Base;

namespace Missbot.AIModule.Gaming.TouhouCard
{
    [UsedImplicitly]
    public class TouhouCardMod : IAIModule
    {
        public override string Name => "东方自定义卡牌";

        private static TouhouCardSvc TouhouCardSvc => AutofacSvc.Resolve<TouhouCardSvc>();

        [ModuleEnter(Command = ".card 幻想乡抽卡", Description = "随机获取一张DIY幻想乡卡牌(每日刷新)")]
        public bool RandomCard(InboxSession session)
        {
            var cardName = TouhouCardSvc.RandomCard(session.User.ID);
            TouhouCardSvc.ShowCard(cardName, session);
            return true;
        }

        [ModuleEnter(Command = "查看卡牌", Description = "查看一张DIY幻想乡卡牌")]
        public bool ViewCardCard(InboxSession session, string name)
        {
            var card = TouhouCardSvc[name];
            if (card == null)
            {
                session.SendBack("未找到相关卡牌！");
                return false;
            }

            TouhouCardSvc.ShowCard(card.Name, session);
            return true;
        }
    }
}